<!DOCTYPE html>












  


<html class="theme-next pisces use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">






















<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.7.0">

<link rel="stylesheet" href="/css/main.css?v=7.1.2">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.1.2">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=7.1.2">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=7.1.2">


  <link rel="mask-icon" href="/images/logo.svg?v=7.1.2" color="#222">







<script id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '7.1.2',
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false,"dimmer":false},
    back2top: true,
    back2top_sidebar: false,
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="Samba文件共享服务 Samba服务程序是由Tridgwell基于SMB（Server Messages Block，服务器消息块）协议开发的">
<meta name="keywords" content="Samba,NFS,AutoFs">
<meta property="og:type" content="article">
<meta property="og:title" content="使用Samba或NFS实现文件共享">
<meta property="og:url" content="https://lzz001.gitee.io/2019/09/26/使用Samba或NFS实现文件共享/index.html">
<meta property="og:site_name" content="小智的博客">
<meta property="og:description" content="Samba文件共享服务 Samba服务程序是由Tridgwell基于SMB（Server Messages Block，服务器消息块）协议开发的">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://img-blog.csdnimg.cn/20190925225058683.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0x6emZhbmdwaQ==,size_16,color_FFFFFF,t_70">
<meta property="og:image" content="https://img-blog.csdnimg.cn/20190925230512417.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0x6emZhbmdwaQ==,size_16,color_FFFFFF,t_70">
<meta property="og:image" content="https://img-blog.csdnimg.cn/2019092523091262.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0x6emZhbmdwaQ==,size_16,color_FFFFFF,t_70">
<meta property="og:updated_time" content="2019-09-26T16:01:00.414Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="使用Samba或NFS实现文件共享">
<meta name="twitter:description" content="Samba文件共享服务 Samba服务程序是由Tridgwell基于SMB（Server Messages Block，服务器消息块）协议开发的">
<meta name="twitter:image" content="https://img-blog.csdnimg.cn/20190925225058683.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0x6emZhbmdwaQ==,size_16,color_FFFFFF,t_70">





  
  
  <link rel="canonical" href="https://lzz001.gitee.io/2019/09/26/使用Samba或NFS实现文件共享/">



<script id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>使用Samba或NFS实现文件共享 | 小智的博客</title>
  






  <script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?297412c3c8589eb0dc190e2d81f12097";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>







  <noscript>
  <style>
  .use-motion .motion-element,
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-title { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>
	<a href="https://github.com/zengzhiLai" target="_blank" class="github-corner" aria-label="View source on GitHub">
		<svg width="100" height="100" viewbox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true">
			<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"/>
			<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"/><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"/>
		</svg>
	</a>
	<style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
	
    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">小智的博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <p class="site-subtitle">慢即是快</p>
      
    
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">

    
    
      
    

    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-about">

    
    
      
    

    

    <a href="/about/" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">

    
    
      
    

    

    <a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">

    
    
      
    

    

    <a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">

    
    
      
    

    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-commonweal">

    
    
      
    

    

    <a href="/404/" rel="section"><i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br>公益 404</a>

  </li>

      
      
    </ul>
  

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://lzz001.gitee.io/2019/09/26/使用Samba或NFS实现文件共享/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="小智">
      <meta itemprop="description" content="Java,Linux,Mysql">
      <meta itemprop="image" content="/images/zhi.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="小智的博客">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">使用Samba或NFS实现文件共享

              
            
          </h1>
        

        <div class="post-meta">

          
          
          

          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2019-09-26 21:19:31" itemprop="dateCreated datePublished" datetime="2019-09-26T21:19:31+08:00">2019-09-26</time>
            </span>
          

          
            

            
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2019-09-27 00:01:00" itemprop="dateModified" datetime="2019-09-27T00:01:00+08:00">2019-09-27</time>
              </span>
            
          

          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/Linux/" itemprop="url" rel="index"><span itemprop="name">Linux</span></a></span>

                
                
              
            </span>
          

          
            
            
          

          
          

          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
                 阅读次数： 
                <span class="busuanzi-value" id="busuanzi_value_page_pv"></span>
              </span>
            </span>
          

          <br>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="Samba文件共享服务"><a href="#Samba文件共享服务" class="headerlink" title="Samba文件共享服务"></a>Samba文件共享服务</h2><ul>
<li><strong>Samba</strong>服务程序是由Tridgwell基于SMB（Server Messages Block，服务器消息块）协议开发的</li>
</ul>
<a id="more"></a>

<h3 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h3><figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># yum install samba</span></span><br></pre></td></tr></table></figure>

<p>配置文件去掉多余注释</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># mv /etc/samba/smb.conf /etc/samba/smb.conf.bak</span></span><br><span class="line"><span class="meta"># cat /etc/samba/smb.conf.bak | grep -v <span class="meta-string">"#"</span> | grep -v <span class="meta-string">";"</span> | grep -v <span class="meta-string">"^$"</span> &gt; /etc/samba/smb.conf</span></span><br><span class="line"><span class="meta"># cat /etc/samba/smb.conf</span></span><br></pre></td></tr></table></figure>

<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line">[global]</span><br><span class="line">	workgroup = MYGROUP        #工作组名称</span><br><span class="line">	server string = Samba Server Version %v   #服务器介绍信息，参数%v为显示SMB版本号</span><br><span class="line">	log file = /var/log/samba/log.%m      #定义日志文件的存放位置与名称，参数%m为来访的主机名</span><br><span class="line">	max log size = 50       #定义日志文件的最大容量为50KB</span><br><span class="line"></span><br><span class="line">	security = user        #安全验证的方式，总共有4种:</span><br><span class="line"><span class="meta">	#</span>share：来访主机无需验证口令；比较方便，但安全性很差</span><br><span class="line">    #user：需验证来访主机提供的口令后才可以访问；提升了安全性</span><br><span class="line"><span class="meta">	#</span>server：使用独立的远程主机验证来访主机提供的口令（集中管理账户）</span><br><span class="line"><span class="meta">	#</span>domain：使用域控制器进行身份验证</span><br><span class="line">	</span><br><span class="line">	passdb backend = tdbsam   #定义用户后台的类型，共有3种:</span><br><span class="line"><span class="meta">	#</span>smbpasswd：使用smbpasswd命令为系统用户设置Samba服务程序的密码</span><br><span class="line"><span class="meta">	#</span>tdbsam：创建数据库文件并使用pdbedit命令建立Samba服务程序的用户</span><br><span class="line"><span class="meta">	#</span>ldapsam：基于LDAP服务进行账户验证   </span><br><span class="line">	            </span><br><span class="line">	load printers = yes  #设置在Samba服务启动时是否共享打印机设备</span><br><span class="line">	cups options = raw  #打印机的选项</span><br><span class="line">[homes] #共享参数</span><br><span class="line">	comment = Home Directories  #描述信息</span><br><span class="line">	browseable = no   #指定共享信息是否在“网上邻居”中可见</span><br><span class="line">	writable = yes   #定义是否可以执行写入操作，与“read only”相反</span><br><span class="line">[printers]  #打印机共享参数</span><br><span class="line">	comment = All Printers  </span><br><span class="line">	path = /var/spool/samba  #共享文件的实际路径(重要)</span><br><span class="line">	browseable = no  </span><br><span class="line">	guest ok = no   #是否所有人可见，等同于"public"参数</span><br><span class="line">	writable = no</span><br><span class="line">	printable = yes</span><br></pre></td></tr></table></figure>

<h3 id="配置共享资源"><a href="#配置共享资源" class="headerlink" title="配置共享资源"></a>配置共享资源</h3><ol>
<li><strong>创建用于访问共享资源的账户信息</strong></li>
</ol>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># id yanji</span></span><br><span class="line">uid=<span class="number">1000</span>(yanji) gid=<span class="number">1000</span>(yanji) groups=<span class="number">1000</span>(yanji)</span><br><span class="line"># pdbedit -a -u yanji</span><br><span class="line"><span class="keyword">new</span> password:  (输入该账户在Samba服务数据库中的密码)</span><br><span class="line">retype <span class="keyword">new</span> password:  (再次确认密码)</span><br><span class="line">Unix username:        yanji</span><br><span class="line">NT username:          </span><br><span class="line">Account Flags:        [U          ]</span><br><span class="line">User SID:             S<span class="number">-1</span><span class="number">-5</span><span class="number">-21</span><span class="number">-464225859</span><span class="number">-96889490</span><span class="number">-2454274357</span><span class="number">-1000</span></span><br><span class="line">Primary Group SID:    S<span class="number">-1</span><span class="number">-5</span><span class="number">-21</span><span class="number">-464225859</span><span class="number">-96889490</span><span class="number">-2454274357</span><span class="number">-513</span></span><br><span class="line">Full Name:            yanji</span><br><span class="line">Home Directory:       \\localhost\yanji</span><br><span class="line">HomeDir Drive:        </span><br><span class="line">Logon Script:         </span><br><span class="line">Profile Path:         \\localhost\yanji\profile</span><br><span class="line">Domain:               LOCALHOST</span><br><span class="line">Account desc:         </span><br><span class="line">Workstations:         </span><br><span class="line">Munged dial:          </span><br><span class="line">Logon time:           <span class="number">0</span></span><br><span class="line">Logoff time:          Wed, <span class="number">06</span> Feb <span class="number">2036</span> <span class="number">23</span>:<span class="number">06</span>:<span class="number">39</span> CST</span><br><span class="line">Kickoff time:         Wed, <span class="number">06</span> Feb <span class="number">2036</span> <span class="number">23</span>:<span class="number">06</span>:<span class="number">39</span> CST</span><br><span class="line">Password last <span class="built_in">set</span>:    Wed, <span class="number">25</span> Sep <span class="number">2019</span> <span class="number">21</span>:<span class="number">56</span>:<span class="number">52</span> CST</span><br><span class="line">Password can change:  Wed, <span class="number">25</span> Sep <span class="number">2019</span> <span class="number">21</span>:<span class="number">56</span>:<span class="number">52</span> CST</span><br><span class="line">Password must change: never</span><br><span class="line">Last bad password   : <span class="number">0</span></span><br><span class="line">Bad password count  : <span class="number">0</span></span><br><span class="line">Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF</span><br></pre></td></tr></table></figure>

<p><code>pdbedit</code>命令用于管理SMB服务程序的账户信息数据库,其参数以及作用：</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td>-a 用户名</td>
<td>建立Samba用户</td>
</tr>
<tr>
<td>-x 用户名</td>
<td>删除Samba用户</td>
</tr>
<tr>
<td>-L</td>
<td>列出用户列表</td>
</tr>
<tr>
<td>-Lv</td>
<td>列出用户详细信息的列表</td>
</tr>
</tbody></table>
<ol start="2">
<li><strong>创建用于共享资源的文件目录</strong></li>
</ol>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># mkdir /home/database</span></span><br><span class="line"><span class="meta"># chown -Rf yanji:yanji /home/database</span></span><br><span class="line"><span class="meta"># semanage fcontext -a -t samba_share_t /home/database</span></span><br><span class="line"><span class="meta"># restorecon -Rv /home/database</span></span><br><span class="line">restorecon reset /home/database context unconfined_u:object_r:<span class="keyword">home_root_t</span>:s0-&gt;unconfined_u:object_r:<span class="keyword">samba_share_t</span>:s0</span><br></pre></td></tr></table></figure>

<ol start="3">
<li><strong>设置SELinux服务与策略，使其允许通过Samba服务程序访问普通用户家目录</strong></li>
</ol>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># getsebool -a | grep samba</span></span><br><span class="line">samba_create_home_dirs --&gt; off</span><br><span class="line">samba_domain_controller --&gt; off</span><br><span class="line">samba_enable_home_dirs --&gt; off</span><br><span class="line">samba_export_all_ro --&gt; off</span><br><span class="line">samba_export_all_rw --&gt; off</span><br><span class="line">samba_portmapper --&gt; off</span><br><span class="line">samba_run_unconfined --&gt; off</span><br><span class="line">samba_share_fusefs --&gt; off</span><br><span class="line">samba_share_nfs --&gt; off</span><br><span class="line">sanlock_use_samba --&gt; off</span><br><span class="line">use_samba_home_dirs --&gt; off</span><br><span class="line">virt_sandbox_use_samba --&gt; off</span><br><span class="line">virt_use_samba --&gt; off</span><br><span class="line"><span class="meta"># setsebool -P samba_enable_home_dirs on</span></span><br></pre></td></tr></table></figure>

<ol start="4">
<li><strong>在Samba服务程序的主配置文件中写入共享信息</strong></li>
</ol>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># vim /etc/samba/smb.conf</span></span><br><span class="line">[global]</span><br><span class="line">        workgroup = MYGROUP</span><br><span class="line">        server <span class="built_in">string</span> = Samba Server Version %v</span><br><span class="line">        <span class="built_in">log</span> file = /var/<span class="built_in">log</span>/samba/<span class="built_in">log</span>.%m</span><br><span class="line">        max <span class="built_in">log</span> size = <span class="number">50</span></span><br><span class="line">        security = user</span><br><span class="line">        passdb backend = tdbsam</span><br><span class="line">        load printers = yes</span><br><span class="line">        cups options = raw</span><br><span class="line">[homes]</span><br><span class="line">        comment = Home Directories</span><br><span class="line">        path = /home/database</span><br><span class="line">        browseable = no</span><br><span class="line">        writable = yes</span><br></pre></td></tr></table></figure>

<ol start="5">
<li>重启smb服务并加入开机启动项，清空iptables防火墙</li>
</ol>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># vim /etc/samba/smb.conf</span></span><br><span class="line"><span class="meta"># vim /etc/samba/smb.conf</span></span><br><span class="line"><span class="meta"># systemctl restart smb</span></span><br><span class="line"><span class="meta"># systemctl enable smb</span></span><br><span class="line">ln -s '/usr/lib/systemd/system/smb.service' '/etc/systemd/system/multi-user.target.wants/smb.service'</span><br><span class="line"><span class="meta"># iptables -F</span></span><br></pre></td></tr></table></figure>

<h3 id="Window挂载共享"><a href="#Window挂载共享" class="headerlink" title="Window挂载共享"></a>Window挂载共享</h3><ol>
<li><strong>在Windows系统中访问共享资源</strong><br>在运行命令框中输入 <strong>两个反斜杠+Samba共享服务器的IP地址</strong><br><img src="https://img-blog.csdnimg.cn/20190925225058683.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0x6emZhbmdwaQ==,size_16,color_FFFFFF,t_70" alt="在Windows系统中访问共享资源"><br>访问Samba共享服务时，提示出错<br><img src="https://img-blog.csdnimg.cn/20190925230512417.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0x6emZhbmdwaQ==,size_16,color_FFFFFF,t_70" alt="访问Samba共享服务时，提示出错"><br>成功访问Samba共享服务：<br><img src="https://img-blog.csdnimg.cn/2019092523091262.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0x6emZhbmdwaQ==,size_16,color_FFFFFF,t_70" alt="成功访问Samba共享服务"></li>
</ol>
<h3 id="Linux挂载共享"><a href="#Linux挂载共享" class="headerlink" title="Linux挂载共享"></a>Linux挂载共享</h3><ol>
<li><p><strong>在Linux客户端<code>RedHat6.8</code>安装支持文件共享服务的软件包（cifs-utils）</strong></p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># yum install cifs-utils</span></span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>在Linux客户端编写认证文件auth.smb（Samba服务的用户名、密码、共享域），并修改权限为：仅root管理员读写</strong></p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># vim auth.smb</span></span><br><span class="line">username=yanji</span><br><span class="line">password=yanji123 </span><br><span class="line">domain=MYGROUP</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>在Linux客户端创建用于挂载Samba服务共享资源的目录，并把挂载信息写入到<code>/etc/fstab</code>文件，确保共享挂载信息在服务器重启后依然生效</strong></p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># echo <span class="meta-string">"//192.168.40.131/yanji /database cifs credentials=/root/auth.smb 0 0"</span> &gt;&gt; /etc/fstab </span></span><br><span class="line"><span class="meta"># mount -a</span></span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>进入到挂载目录/database可看到Windows系统访问Samba服务程序时留下来的文件</strong></p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># ll /database/</span></span><br><span class="line">总用量 <span class="number">4</span></span><br><span class="line">-rwxr--r-- <span class="number">1</span> <span class="number">1000</span> <span class="number">1000</span> <span class="number">10</span> <span class="number">9</span>月  <span class="number">25</span> <span class="number">23</span>:<span class="number">08</span> test.txt</span><br><span class="line"><span class="meta"># cat /database/test.txt </span></span><br><span class="line">test</span><br><span class="line">test</span><br></pre></td></tr></table></figure>

</li>
</ol>
<h2 id="NFS网络文件系统"><a href="#NFS网络文件系统" class="headerlink" title="NFS网络文件系统"></a>NFS网络文件系统</h2><ul>
<li><p>共享文件的主机都是Linux系统时，推荐在客户端部署NFS服务来共享文件</p>
</li>
<li><p>NFS（网络文件系统）服务可以将远程Linux系统上的文件共享资源挂载到本地主机的目录上，从而使得本地主机（Linux客户端）基于<strong>TCP/IP协议</strong>，像使用本地主机上的资源那样读写远程Linux系统上的共享文件</p>
</li>
<li><p>NFS服务程序的配置文件为<code>/etc/exports</code>，默认情况下里面没有任何内容</p>
<p>用于配置NFS服务程序配置文件的参数：</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td>ro</td>
<td>只读</td>
</tr>
<tr>
<td>rw</td>
<td>读写</td>
</tr>
<tr>
<td>root_squash</td>
<td>当NFS客户端以root管理员访问时，映射为NFS服务器的匿名用户</td>
</tr>
<tr>
<td>no_root_squash</td>
<td>当NFS客户端以root管理员访问时，映射为NFS服务器的root管理员</td>
</tr>
<tr>
<td>all_squash</td>
<td>无论NFS客户端使用什么账户访问，均映射为NFS服务器的匿名用户</td>
</tr>
<tr>
<td>sync</td>
<td>同时将数据写入到内存与硬盘中，保证不丢失数据</td>
</tr>
<tr>
<td>async</td>
<td>优先将数据保存到内存，然后再写入硬盘；这样效率更高，但可能会丢失数据</td>
</tr>
</tbody></table>
</li>
</ul>
<ol>
<li><strong>安装NFS服务</strong></li>
</ol>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># yum install nfs-utils</span></span><br></pre></td></tr></table></figure>

<ol start="2">
<li><p><strong>在NFS服务器上建立用于NFS文件共享的目录，并设置足够的权限确保其他人也有写入权限</strong></p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># mkdir /nfsfile</span></span><br><span class="line"><span class="meta"># chmod -Rf 777 /nfsfile</span></span><br><span class="line"><span class="meta"># echo <span class="meta-string">"This is NFS"</span> &gt; /nfsfile/readme</span></span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>将<code>/nfsfile</code>目录共享给<code>192.168.40.0/24</code>网段内的所有主机</strong><code>NFS客户端地址与权限之间没有空格</code></p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># vim /etc/exports</span></span><br><span class="line">/nfsfile <span class="number">192.168</span><span class="number">.40</span>.*(rw,sync,root_squash)</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>启动和启用NFS服务程序</strong><br>使用NFS服务进行文件共享之前，需要使用RPC（Remote Procedure Call，远程过程调用）服务将NFS服务器的IP地址和端口号等信息发送给客户端</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># systemctl restart rpcbind</span></span><br><span class="line"><span class="meta"># systemctl enable rpcbind</span></span><br><span class="line"><span class="meta"># systemctl start nfs-server</span></span><br><span class="line"><span class="meta"># systemctl enable nfs-server</span></span><br><span class="line">ln -s '/usr/lib/systemd/system/nfs-server.service' '/etc/systemd/system/nfs.target.wants/nfs-server.service'</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>NFS客户端查询NFS服务器的远程共享信息</strong></p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># showmount -e 192.168.40.131</span></span><br><span class="line">Export <span class="built_in">list</span> <span class="keyword">for</span> <span class="number">192.168</span><span class="number">.40</span><span class="number">.131</span>:</span><br><span class="line">/nfsfile <span class="number">192.168</span><span class="number">.40</span>.*</span><br></pre></td></tr></table></figure>

</li>
</ol>
<p><code>showmount</code>命令中可用的参数以及作用：</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td>-e</td>
<td>显示NFS服务器的共享列表</td>
</tr>
<tr>
<td>-a</td>
<td>显示本机挂载的文件资源的情况NFS资源的情况</td>
</tr>
<tr>
<td>-v</td>
<td>显示版本号</td>
</tr>
</tbody></table>
<ol start="6">
<li><strong>在NFS客户端创建一个挂载目录</strong></li>
</ol>
<p>-t：指定挂载的文件系统的类型，后面是<code>服务器的IP地址</code>、<code>服务器上的共享目录</code>、<code>要挂载到本地系统（即客户端）的目录</code></p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># mkdir  /nfsfile</span></span><br><span class="line"><span class="meta"># mount -t nfs 192.168.40.131:/nfsfile /nfsfile</span></span><br></pre></td></tr></table></figure>

<ol start="7">
<li><strong>查看NFS共享文件，为使服务一直有效，将其写入到fstab文件中</strong></li>
</ol>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># cat /nfsfile/readme </span></span><br><span class="line">This is NFS</span><br><span class="line"><span class="meta"># echo <span class="meta-string">"192.168.40.131:/nfsfile /nfsfile nfs defaults 0 0"</span> &gt;&gt; /etc/fstab</span></span><br></pre></td></tr></table></figure>

<h2 id="AutoFs自动挂载服务"><a href="#AutoFs自动挂载服务" class="headerlink" title="AutoFs自动挂载服务"></a>AutoFs自动挂载服务</h2><ul>
<li>挂载的远程资源太多，会给网络带宽和服务器的硬件资源带来很大负载</li>
<li>资源挂载后长期不使用，也会造成服务器硬件资源的浪费</li>
<li><code>autofs</code>服务程序是一种<code>Linux系统守护进程</code>，当检测到用户试图访问一个尚未挂载的文件系统时，将自动挂载该文件系统</li>
</ul>
<ol>
<li><p><strong>安装autofs服务</strong></p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># yum install -y autofs</span></span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>在autofs服务的主配置文件中写入挂载目录，后缀建议以.misc结束</strong></p>
</li>
</ol>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># vim /etc/auto.master</span></span><br><span class="line">...</span><br><span class="line">/media /etc/iso.misc</span><br><span class="line">/misc /etc/<span class="keyword">auto</span>.misc</span><br><span class="line">...</span><br></pre></td></tr></table></figure>

<ol start="3">
<li><strong>编辑子配置文件</strong></li>
</ol>
<p>-fstype：文件系统格式参数，iso9660为光盘设备格式<br>ro、nosuid及nodev：光盘设备具体的权限参数<br>/dev/cdrom：定义要挂载的设备名称</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># vim /etc/auto.master</span></span><br><span class="line">iso   -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom</span><br></pre></td></tr></table></figure>

<ol start="4">
<li><strong>验证autofs服务</strong><br>先查看当前的光盘设备挂载情况，确认光盘设备没有被挂载上，<code>/media</code>目录中也没有iso子目录，<code>cd</code>到<code>iso</code>子目录时，光盘设备被立即自动挂载，顺利查看到了光盘的内容</li>
</ol>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"># df -h</span></span><br><span class="line">Filesystem             Size  Used Avail Use% Mounted on</span><br><span class="line">/dev/mapper/rhel-root   <span class="number">18</span>G  <span class="number">3.1</span>G   <span class="number">15</span>G  <span class="number">18</span>% /</span><br><span class="line">devtmpfs               <span class="number">985</span>M     <span class="number">0</span>  <span class="number">985</span>M   <span class="number">0</span>% /dev</span><br><span class="line">tmpfs                  <span class="number">994</span>M   <span class="number">84</span>K  <span class="number">994</span>M   <span class="number">1</span>% /dev/shm</span><br><span class="line">tmpfs                  <span class="number">994</span>M  <span class="number">8.9</span>M  <span class="number">986</span>M   <span class="number">1</span>% /run</span><br><span class="line">tmpfs                  <span class="number">994</span>M     <span class="number">0</span>  <span class="number">994</span>M   <span class="number">0</span>% /sys/fs/cgroup</span><br><span class="line">/dev/sda1              <span class="number">497</span>M  <span class="number">119</span>M  <span class="number">379</span>M  <span class="number">24</span>% /boot</span><br><span class="line"></span><br><span class="line"><span class="meta"># cd /media/</span></span><br><span class="line"><span class="meta"># ls</span></span><br><span class="line"><span class="meta"># cd iso</span></span><br><span class="line"><span class="meta"># ls</span></span><br><span class="line">addons  EULA  images    LiveOS      Packages       repodata                 RPM-GPG-KEY-redhat-release</span><br><span class="line">EFI     GPL   isolinux  media.repo  release-notes  RPM-GPG-KEY-redhat-beta  TRANS.TBL</span><br><span class="line"><span class="meta"># df -h</span></span><br><span class="line">Filesystem             Size  Used Avail Use% Mounted on</span><br><span class="line">/dev/mapper/rhel-root   <span class="number">18</span>G  <span class="number">3.1</span>G   <span class="number">15</span>G  <span class="number">18</span>% /</span><br><span class="line">devtmpfs               <span class="number">985</span>M     <span class="number">0</span>  <span class="number">985</span>M   <span class="number">0</span>% /dev</span><br><span class="line">tmpfs                  <span class="number">994</span>M   <span class="number">84</span>K  <span class="number">994</span>M   <span class="number">1</span>% /dev/shm</span><br><span class="line">tmpfs                  <span class="number">994</span>M  <span class="number">8.9</span>M  <span class="number">986</span>M   <span class="number">1</span>% /run</span><br><span class="line">tmpfs                  <span class="number">994</span>M     <span class="number">0</span>  <span class="number">994</span>M   <span class="number">0</span>% /sys/fs/cgroup</span><br><span class="line">/dev/sda1              <span class="number">497</span>M  <span class="number">119</span>M  <span class="number">379</span>M  <span class="number">24</span>% /boot</span><br><span class="line">/dev/sr0               <span class="number">3.5</span>G  <span class="number">3.5</span>G     <span class="number">0</span> <span class="number">100</span>% /media/iso</span><br></pre></td></tr></table></figure>


      
    </div>

    

    
    
    

    

    
      
    
    

    

    <footer class="post-footer">
      
        
          
        
        <div class="post-tags">
          
            <a href="/tags/Samba/" rel="tag"># Samba</a>
          
            <a href="/tags/NFS/" rel="tag"># NFS</a>
          
            <a href="/tags/AutoFs/" rel="tag"># AutoFs</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2019/09/23/Spring-Boot-Thymeleaf学习/" rel="next" title="Spring Boot + Thymeleaf学习">
                <i class="fa fa-chevron-left"></i> Spring Boot + Thymeleaf学习
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2019/10/01/数据结构与算法——递归/" rel="prev" title="数据结构与算法——递归">
                数据结构与算法——递归 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  
    <div class="comments" id="gitalk-container">
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/images/zhi.jpg" alt="小智">
            
              <p class="site-author-name" itemprop="name">小智</p>
              <div class="site-description motion-element" itemprop="description">Java,Linux,Mysql</div>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">22</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  
                    
                      <a href="/categories/">
                    
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">5</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  
                    
                      <a href="/tags/">
                    
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">37</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          

          

          

          

          
          

          
            
          
          

        </div>
      </div>

      
      <!--noindex-->
        <div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
            
            
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#Samba文件共享服务"><span class="nav-number">1.</span> <span class="nav-text">Samba文件共享服务</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#安装"><span class="nav-number">1.1.</span> <span class="nav-text">安装</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#配置共享资源"><span class="nav-number">1.2.</span> <span class="nav-text">配置共享资源</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Window挂载共享"><span class="nav-number">1.3.</span> <span class="nav-text">Window挂载共享</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Linux挂载共享"><span class="nav-number">1.4.</span> <span class="nav-text">Linux挂载共享</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#NFS网络文件系统"><span class="nav-number">2.</span> <span class="nav-text">NFS网络文件系统</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#AutoFs自动挂载服务"><span class="nav-number">3.</span> <span class="nav-text">AutoFs自动挂载服务</span></a></li></ol></div>
            

          </div>
        </div>
      <!--/noindex-->
      

      

    </div>
  </aside>
  


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">小智</span>

  

  
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    
      <span class="post-meta-item-text">站点阅读时长 &asymp;</span>
    
    <span title="站点阅读时长">2:07</span>
  
</div>









        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="post-meta-item-icon">
      <i class="fa fa-user"></i>
    </span>
    <span class="site-uv" title="总访客量">
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  

  
    <span class="post-meta-divider">|</span>
  

  
    <span class="post-meta-item-icon">
      <i class="fa fa-eye"></i>
    </span>
    <span class="site-pv" title="总访问量">
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>









        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

    

    
  </div>

  

<script>
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  <script src="/lib/jquery/index.js?v=3.4.1"></script>

  
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>


  


  <script src="/js/utils.js?v=7.1.2"></script>

  <script src="/js/motion.js?v=7.1.2"></script>



  
  


  <script src="/js/affix.js?v=7.1.2"></script>

  <script src="/js/schemes/pisces.js?v=7.1.2"></script>



  
  <script src="/js/scrollspy.js?v=7.1.2"></script>
<script src="/js/post-details.js?v=7.1.2"></script>



  


  <script src="/js/next-boot.js?v=7.1.2"></script>


  

  

  

  


  
    

<script src="//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>



<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.css">



<script src="//cdn.jsdelivr.net/npm/js-md5@0.7.3/src/md5.min.js"></script>

<script>
  var gitalk = new Gitalk({
    clientID: '4a3937b2ec1408fa593c',
    clientSecret: 'bb11519c1d0aafd8540c58fe182487d24b1a1a6f',
    repo: 'zengzhiLai.github.io',
    owner: 'zengzhiLai',
    admin: ['zengzhiLai'],
    id: md5(location.pathname),
    
      language: window.navigator.language || window.navigator.userLanguage,
    
    distractionFreeMode: 'true'
  });
  gitalk.render('gitalk-container');
</script>

  


  




  

  

  

  

  

  
  <script>
    (function(){
      var bp = document.createElement('script');
      var curProtocol = window.location.protocol.split(':')[0];
      bp.src = (curProtocol === 'https') ? 'https://zz.bdstatic.com/linksubmit/push.js' : 'http://push.zhanzhang.baidu.com/push.js';
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(bp, s);
    })();
  </script>


  

  

  

  

  

  

  

  

</body>
</html>
<!-- 页面点击小红心 -->
	<script type="text/javascript" src="js/schemes/clicklove.js"></script>